import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CarhistoryRentalVO, CarhistoryRentalForm, CarhistoryRentalQuery } from '@/api/zichanguanli/carhistoryRental/types';

/**
 * 查询汽车租赁历史列表
 * @param query
 * @returns {*}
 */

export const listCarhistoryRental = (query?: CarhistoryRentalQuery): AxiosPromise<CarhistoryRentalVO[]> => {
  return request({
    url: '/zichanguanli/carhistoryRental/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询汽车租赁历史详细
 * @param id
 */
export const getCarhistoryRental = (id: string | number): AxiosPromise<CarhistoryRentalVO> => {
  return request({
    url: '/zichanguanli/carhistoryRental/' + id,
    method: 'get'
  });
};

/**
 * 新增汽车租赁历史
 * @param data
 */
export const addCarhistoryRental = (data: CarhistoryRentalForm) => {
  return request({
    url: '/zichanguanli/carhistoryRental',
    method: 'post',
    data: data
  });
};

/**
 * 修改汽车租赁历史
 * @param data
 */
export const updateCarhistoryRental = (data: CarhistoryRentalForm) => {
  return request({
    url: '/zichanguanli/carhistoryRental',
    method: 'put',
    data: data
  });
};

/**
 * 删除汽车租赁历史
 * @param id
 */
export const delCarhistoryRental = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/carhistoryRental/' + id,
    method: 'delete'
  });
};
